package com.qf.day07.poly02;

/**
 * 圆形子类
 */
public class Circle extends TuXing {
//    圆的半径
    private double r;
    public final static double PAI = 3.14;
    @Override
    public double zc() {
//        调用父类周长方法
        double zc=2*r*PAI;
        System.out.println(getName()+"的周长为:"+zc);
        return zc;
    }

    @Override
    public double area() {
        double area = r*r*PAI;
        System.out.println(getName()+"的面积为"+area);
        return area;
    }

    public Circle() {
        super("圆");
    }

    public Circle(String name, double r) {
        super(name);
        this.r = r;
    }

    public double getR() {
        return r;
    }

    public void setR(double r) {
        this.r = r;
    }

    @Override
    public String toString() {
        return "Circle{" +
                "r=" + r +
                "} " + super.toString();
    }
}
